#pragma once
#include <windows.h>
#include <d3d11.h>
#include <xnamath.h>
#include <cassert>

struct Geometry{

	Geometry();
	~Geometry();

	HRESULT Load(void* pVert, size_t vertSize, size_t nVerts, UINT* pIndices, size_t nIndices);
	HRESULT Init(ID3D11Device* device, ID3D11DeviceContext* imContext);
	HRESULT Render();

	XMMATRIX m_world;

protected:
	void*				m_pVerts;
	size_t				m_vertSize;
	size_t				m_nVerts;
	UINT*				m_pIndices;
	size_t				m_nIndices;
	ID3D11Buffer* m_pvBuf, *m_piBuf;
	ID3D11Device*		m_device;
	ID3D11DeviceContext*m_imContext;
};

enum GEOMETRY_TYPE{
	GEOMETRY_TYPE_MESH,
	GEOMETRY_TYPE_LINE,
};

//for lines
struct LineVertex{
	XMFLOAT4 vl;
};

extern D3D11_INPUT_ELEMENT_DESC lineLayout[];
extern size_t nLineLayout;

struct LineCBuffer{
	XMMATRIX worldViewProj;
	XMFLOAT4 color;
};
//for meshes
struct MeshVertex{
	XMFLOAT4 v;
	XMFLOAT4 n;
	XMFLOAT2 t;
};

extern D3D11_INPUT_ELEMENT_DESC meshLayout[];
extern size_t nMeshLayout;

struct MeshCBuffer{
	XMMATRIX worldView;
	XMMATRIX proj;
	XMFLOAT4 color;
};